/*
 * @Author: hanxin 
 * @Date: 2021-08-14 19:27:54 
 * @Last Modified by: hanxin
 * @Last Modified time: 2021-08-14 21:15:38
 * 该类用于替代数据库存储离线消息
 */
package ServerService;

import java.util.ArrayList;
import java.util.concurrent.ConcurrentHashMap;

import common.Message;

public class offline_Message_Save {
    // arraylist用于存储多条message对象,hashmap用于存放用户与arraylist
    private static ConcurrentHashMap<String, ArrayList<Message>> cHashMap = new ConcurrentHashMap<>();

    /**
     * 存放接收者与它的离线消息方法
     * @param getter
     * @param arrayList
     */
    public static void saveMessage(String getter, ArrayList<Message> arrayList) {

        cHashMap.put(getter, arrayList);
    }

    public static ArrayList<Message> takeMessage(String getter) {
        ArrayList<Message> arrayList = cHashMap.get(getter);
        return arrayList;

    }

}
